package com.oriental.manage.controller.reserve.business;

import com.oriental.manage.core.paging.Pagination;
import com.oriental.manage.core.response.ResponseDTO;
import com.oriental.manage.service.reserve.ReportAdjustmentService;
import com.oriental.reserve.model.report.ReportBaseDataDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Author: Yang xp
 * Date: 2017/3/2
 * Time: 10:02
 * Desc：备付金调整报表
 */
@Controller
@Slf4j
@RequestMapping("/reserve/report/base/data")
public class ReserveReporBaseDataController {

    @Autowired
    private ReportAdjustmentService reportAdjustmentService;

    @RequestMapping("/init")
    public String init(){
        return "reserve/report/searchReportBaseData";
    }

    @RequestMapping("/search")
    @ResponseBody
    public ResponseDTO<Pagination<ReportBaseDataDto>> query(@RequestBody Pagination<ReportBaseDataDto> pagination){
        ResponseDTO<Pagination<ReportBaseDataDto>> responseDTO = new ResponseDTO<>();
        try {
            log.info("基础数据查询请求:{}",pagination);
            reportAdjustmentService.queryReportBaseData(responseDTO,pagination,pagination.getQueryBean());
            log.info("余额信息查询:{},{}", responseDTO, pagination);
        } catch (Exception e) {
            log.error("余额信息查询失败", e);
            responseDTO.setSuccess(false);
            responseDTO.setMsg("余额信息查询失败");
        }
        return responseDTO;
    }


}
